package com.concurrent.chapter7.concurrent01;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Run2 {
	public static void main(String[] args) {
		try {
			List list = new ArrayList<>();
			list.add(new MyCallableA());
			list.add(new MyCallableB2());
			ExecutorService executorService = Executors.newCachedThreadPool();
			String getValueA = executorService.invokeAny(list);
			System.out.println("Run1.main() getValueA=" + getValueA);
			System.out.println("Run1.main() end");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
